package com.fj.user.web;

import com.fj.domain.User;
import com.fj.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author fj
 * @date 2024/3/11 23:55
 */
@RestController
@RequestMapping(value = "user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "{uid}",method = RequestMethod.GET)
    public User getUser(@PathVariable(value = "uid") Integer uid){
        return userService.getUser(uid);
    }

    @RequestMapping(value = "reduceMoney",method = RequestMethod.POST)
    public User reduceMoney(@RequestParam("uid") Integer uid,@RequestParam("money") Integer money){
        return userService.reduceMoney(uid,money);
    }
}
